package com.itheima.d2_final;

/**
 * 静态常量的赋值，一般是直接赋值（推荐）。也可以使用静态代码块来赋值
 */
public class FinalDemo2 {
    final static String SCHOOL_NAME = "黑马"; //一定要赋值（初始化），否则会报错 ---> 也可以在静态代码块中进行赋值

    static {
//        SCHOOL_NAME = "黑马";
    }

    public static void main(String[] args) {
        // 目标：认识常量及其作用
        System.out.println("SCHOOL_NAME = " + SCHOOL_NAME);
    }
}

class Demo3{
    public static void main(String[] args) {
        System.out.println(FinalDemo2.SCHOOL_NAME);
//        FinalDemo2.SCHOOL_NAME = "传智"; //报错：Cannot assign a value to final variable 'SCHOOL_NAME'
    }
}